﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace MTK_BieuThuc
{
    public class SubExpr : BinaryExpr
    {
        public SubExpr(Expression expr1, Expression expr2)
        {
            this.expr1 = expr1;
            this.expr2 = expr2;
        }
        public override double Evuluate(double x)
        {
            return expr1.Evuluate(x) - expr2.Evuluate(x);
        }

        public override Expression createDerive()
        {
            return new SubExpr(expr1.derive() , expr2.derive());
        }
        public override string toString(StrategyString ss)
        {
             return ss.toString(this, expr1, expr2);;
        }

        public override string getOperator()
        {
            return "-";
        }
        
    }
}
